package com.junzhiit.nengji.model.enums;

import com.bainaeco.framework.exception.InvalidArgumentException;

public enum MemberCardValidTime {
	
	FOREVER(0,"永久"),
	FIXED(1,"固定日期"),
	PERIOD(2,"一段时间内有效");
	
	private Integer status;
	
	private String value;

	private MemberCardValidTime(Integer status,String value){
		this.status = status;
		this.value = value;
	}

	public int toIntStatus() {
		return this.status;
	}
	
	public String toStringValue() {
		return this.value;
	}

	public static MemberCardValidTime toStatus(int status) {
		if (FOREVER.status == status) {
			return FOREVER;
		} else if (FIXED.status == status) {
			return FIXED;
		} else if (PERIOD.status == status) {
			return PERIOD;
		} else {
			throw new InvalidArgumentException("Unknown MemberCardValidTime[" + status + "].");
		}
	}
}
